﻿using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Web.SessionState;

namespace YXShop.Web.filehandle
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class outofstockform : IHttpHandler, IRequiresSessionState 
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            YXShop.BLL.Accessories.Outofstock bll = new YXShop.BLL.Accessories.Outofstock();
            YXShop.Model.Accessories.Outofstock model = new YXShop.Model.Accessories.Outofstock();
            //无用的商品ID
            model.Proid = 0;
            model.UserName = ChangeHope.WebPage.PageRequest.GetFormString("txtUsrName");
            model.IssRegUser = 0;
            if (context.Session["MemberID"] != null)
            {
                model.UserName = context.Session["MemberName"].ToString();
                model.IssRegUser = 1;
            }
            model.ProClassAndName = ChangeHope.WebPage.PageRequest.GetFormString("txtProductClass") + "|" + ChangeHope.WebPage.PageRequest.GetFormString("proName");
            model.AddTime = DateTime.Now;
            model.AddIp = context.Request.UserHostAddress;
            model.Telphone = ChangeHope.WebPage.PageRequest.GetFormString("txtPhone");
            model.Mobile = ChangeHope.WebPage.PageRequest.GetFormString("txtMobile");
            model.QQ = ChangeHope.WebPage.PageRequest.GetFormString("txtQQ");
            model.Email = ChangeHope.WebPage.PageRequest.GetFormString("txtEmail");
            model.MSN = ChangeHope.WebPage.PageRequest.GetFormString("txtMSN");
            //无用
            model.NeedNum = 1;
            model.Content = ChangeHope.WebPage.PageRequest.GetFormString("txtContent");
            model.State = 1;
            model.IsDeal = 1;
            model.DealTime = DateTime.Now;
            model.DealRemark = string.Empty;
            if (bll.Add(model) != 0)
            {
                YXShop.Common.SysParameter sp = new YXShop.Common.SysParameter();
                context.Response.Redirect(sp.DummyPaht + "other/outStock.aspx");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
